package com.software.chemistry.repository;

import com.software.chemistry.entity.ModelInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ModelInfoRepository extends JpaRepository<ModelInfo, String>, JpaSpecificationExecutor {

    List<ModelInfo> findModelInfoByTypeId(String typeId);

//    @Query("SELECT m FROM ModelInfo m WHERE m.modelName LIKE CONCAT('%',:obtain,'%')" +
//            "OR m.modelDescription LIKE CONCAT('%',:obtain,'%')" )
    @Query("SELECT m FROM ModelInfo m WHERE m.modelName LIKE CONCAT('%',:obtain,'%')")
    List<ModelInfo> findByModelNameOrModelDescription(@Param("obtain") String obtain);
}
